home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HyperLib 1997 Winter - Disc 1
/
HYPERLIB-1997-Winter-CD1.ISO.7z
/
HYPERLIB-1997-Winter-CD1.ISO
/
オンラインウェア
/
PRG
/
Menu Events 1.3.sit
/
Menu Events 1.3
/
Menu Events Sample Script
< prev
next >
Wrap
Text File
|
1996-02-24
|
2KB
|
37 lines
set dialogResult to display dialog ツ
"Which application?" default answer "" buttons {"Cancel", "Chooseノ", "OK"} default button "OK"
if button returned of dialogResult is "OK" then
set targetApplication to application (text returned of dialogResult)
else
set targetApplication to choose application
end if
tell targetApplication
try
with timeout of 30 seconds -- some applications won't respond to Menu events
set menuListInfo to Query Menu List
end timeout
on error errorString number errorNumber
if errorNumber is -126 then -- dsMBarNFnd
error "Sorry, that program does not have a menu bar. It may be background-only." number -126
else
error errorString number errorNumber
end if
end try
if (count of menuListInfo) is greater than 0 then
set menuListText to menu title of item 1 of menuListInfo
repeat with menuIndex from 2 to count of menuListInfo
set menuListText to menuListText & ", " & menu title of item menuIndex of menuListInfo
end repeat
tell me to display dialog "The menu titles are " & menuListText & "."
end if
set menuInfo to Query Menu menu title "File"
repeat with menuItemID from 1 to count of menuInfo
set menuItemInfo to item menuItemID of menuInfo
if menu item enabled of menuItemInfo then
tell me to display dialog "File menu item メ" & (menu item text of menuItemInfo) & "モ is enabled."
end if
end repeat
Select Menu Item menu title "File" menu item text "Quit" with option key -- Option-Quit
end tell
display dialog "The application has quit. Goodbye!"